//
//  MD5.swift
//  NewNGPlay
//
//  Created by YMac on 2017/12/18.
//  Copyright © 2017年 zchd. All rights reserved.
//

open class YMD5Utils{
    open class func getMD5(_ string:String) -> String{
        let cStr = string.cString(using: String.Encoding.utf8);
        let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: 16)
        CC_MD5(cStr!,(CC_LONG)(strlen(cStr!)), buffer)
        let md5String = NSMutableString();
        for i in 0 ..< 16 {
            md5String.appendFormat("%02x", buffer[i])
        }
        free(buffer)
        return md5String as String
    }
}
